home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
rjs.lha
/
RJS
/
String
/
tests
/
qtest1.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-14
|
1KB
|
49 lines
#include <iostream.h>
#include <ctype.h>
#include "RJS/String.h"
void main()
{
// String::set_hunksize(1);
String s1;
cout << "Enter string: ";
cin >> s1;
StringScan word(s1,StringScan::ByMatch,SSword);
String w;
while(word(w)) cout << '$' << w << '$' << endl;
s1="hello there world";
StringSearch ss("there");
cout << s1.at(ss) << endl;
s1="12 x 34";
cout << "'" << s1 << "'" << endl;
junk(s1.at("x"));
cout << "'" << s1 << "'" << endl;
s1="ab 12 cd";
cout << "'" << s1 << "'" << endl;
cout << "'" << (s1.at("12") += "34") << "'" << endl;
cout << "'" << s1 << "'" << endl;
s1="12 y 34";
cout << "'" << s1 << "'" << endl;
cout << "'" << s1.at("y").append("z").prepend("x").insert(0,"w") << "'" << endl;
cout << "'" << s1 << "'" << endl;
s1="hello XXX world";
cout << "'" << s1 << "'" << endl;
cout << "Enter word:";
cin >> s1.substr(6,3) ; // input from standard input to substring XXX
cout << "'" << s1 << "'" << endl;
//cout << "Number of tests that passed ==> " << num_pass << endl;
//cout << "Number of tests that failed ==> " << num_fail << endl;
}